load("@rules_cc//cc:defs.bzl", "cc_library")

cc_library(
    name = "libgpiod_c",
    srcs = glob(
        [
            "lib/*.c",
        ],
    ),
    hdrs = glob([
        "include/*.h",
    ]),
    defines = [
        "HAVE_LINUX_GPIO_H=1",
        "HAVE_LINUX_VERSION_H=1",
        "HAVE_SYS_SYSMACROS_H=1",
        "_GNU_SOURCE",
    ],
    includes = [
        "include",
    ],
    visibility = ["//visibility:public"],
)

cc_library(
    name = "libgpiod_cxx",
    srcs = glob([
        "bindings/cxx/*.cpp",
    ]),
    hdrs = glob([
        "bindings/cxx/*.hpp",
    ]),
    defines = [
        "HAVE_LINUX_GPIO_H=1",
        "HAVE_LINUX_VERSION_H=1",
        "HAVE_SYS_SYSMACROS_H=1",
        "_GNU_SOURCE",
    ],
    includes = [
        "bindings/cxx",
    ],
    visibility = ["//visibility:public"],
    deps = [
        ":libgpiod_c",
    ],
)

cc_library(
    name = "libgpiod",
    visibility = ["//visibility:public"],
    deps = [
        ":libgpiod_c",
        ":libgpiod_cxx",
    ],
)
